<template>
  <div>
    <div class="head">
      <p class="text">好软推荐</p>
      <van-icon
        @click="onClickLeft()"
        size="20"
        color="whitesmoke"
        name="arrow-left"
        class="icon"
      />
    </div>
    <br />
    <div class="guess_like">
      <br />
      <div class="guess_like_show" @click="jumpDetail(item,index)" v-for="(item, index) in list" :key="index">
        <van-image radius="10"
          class="guess_like_img"
          width="50"
          height="50"
          :src="item.app_image_road"
        />
        <span class="guess_like_sp1">{{ item.app_name }}</span>
        <span class="guess_like_sp2"
          >下载次数：{{ item.app_downloding_times }}</span
        >
        <van-button class="guess_like_small" size="small" @click.stop="downloadButton(item,index)" round type="info"
          >下载</van-button
        >
      </div>
    </div>
  </div>
</template>
<script>
import http from '../api/index';
export default {
  data() {
    return {
      list: [],
    };
  },
  methods: {
    downloadButton(item,index){
           window.location.href='http://whole555.oss-cn-beijing.aliyuncs.com/whole/2020/10/15/16027471177286380.apk';
http.downloadTimes({
        app_id:item.app_id
      }).then(r => {
        console.log(r);
        item.app_downloding_times=r.data;
      })
    },
    // 跳到详情
    jumpDetail(item,index){
      this.$router.push('/softDetails/'+item.app_id);
    },
    onClickLeft() {
      this.$router.push('/softGame');
    },
  },
  mounted() {
     http.getGoodSoft({
         pages:1,
         app_father_type_id:1
     }).then((r) => {
      console.log(r);
      this.list = r.data;
    });
  },
};
</script>
<style scoped>
.head {
  width: 100%;
  height: 4rem;
  background-color: rgb(108, 144, 243);
}
.text {
  text-align: center;
  font-size: 1.6rem;
  color: whitesmoke;
  line-height: 4rem;
}
.icon {
  position: absolute;
  top: 1.1rem;
  /* left: 0px; */
}
.guess_like {
  width: 96%;
  margin: 0 auto;
  border-radius: 1.5rem;
  background-color: white;
}
.guess_text {
  position: relative;
}
.guess_text_sp1 {
  position: absolute;
  left: 1.5rem;
  top: 1.5rem;
  font-size: 1.6rem;
}
.guess_arrow {
  position: absolute;
  right: 1rem;
  top: 1.3rem;
  font-size: 2rem;
}
.guess_like_show {
  width: 96%;
  height: 6rem;
  position: relative;
  margin-top: 2rem;
}
.guess_like_img {
  position: absolute;
  top: 0px;
  left: 2rem;
  border-radius: 1rem;
}
.guess_like_sp1 {
  position: absolute;
  top: 0.1rem;
  left: 8.5rem;
  font-size: 1.8rem;
  color: #252525;
}
.guess_like_sp2 {
  position: absolute;
  top: 3rem;
  left: 8.5rem;
  font-size: 1.4rem;
  color: #7a7a7a;
}
.guess_like_small {
  position: absolute;
  top: 0.8rem;
  right: 0px;
  width: 7rem;
}
</style>